<meta charset="UTF-8">
<?php
include_once("../functions/db_manipulate.php");

if (!init()) {
  redirect("?action=login");
}
connectDB();

startTransaction();

$resultSet = null;

if ($_POST['galvis'] == "true") {
  $resultSet = mysql_query("UPDATE users SET galvis='1' WHERE id='" . $_SESSION['id'] . "'");
} else if ($_POST['galvis'] == "false") {
  $resultSet = mysql_query("UPDATE users SET galvis='0' WHERE id='" . $_SESSION['id'] . "'");
}
//else {
//  redirect($_SERVER['HTTP_REFERER']);
//}

if ($resultSet) {
  commitTransaction();
} else {
  rollbackTransaction();
}

redirect($_SERVER['HTTP_REFERER']);
